home *** CD-ROM | disk | FTP | other *** search
/ Almathera Ten Pack 3: CDPD 3 / Almathera Ten on Ten - Disc 3: CDPD3.iso / scope / 176-200 / scopedisk180 / arexxtutorial / rexxarplib / alter.rexx < prev    next >
OS/2 REXX Batch file  |  1995-03-19  |  751b  |  41 lines

  1. /** alter.rexx
  2. *
  3. *   This function edits all the files containing one or more occurrences
  4. *   of a search string and sets the editor in searc/replace mode using a
  5. *   replacement string.
  6. *
  7. **/
  8. parse arg fn ss rs .
  9.  
  10. options prompt "Next? "
  11.  
  12. if rs = "" then do
  13.    say "Usage: alter <wildcards> <search string> <replace string>"
  14.    exit
  15. end
  16.  
  17. if ~show('l','rexxarplib.library') then addrexxlib
  18.  
  19. 'search 'fn' 'ss' quiet | execio stem files.'
  20.  
  21. do i = 1 to files.0
  22.    if files.i = "" then leave
  23.  
  24.    if i ~= 1 then do
  25.       parse pull yesno
  26.       if left(yesno, 1) = 'n' then do
  27.          say "Aborted"
  28.          exit
  29.       end
  30.    end
  31.  
  32.    call setenv('Search', ss)
  33.    call setenv('Replace', rs)
  34.  
  35.    'e 'files.i' startup alter.txed sticky'
  36. end
  37.  
  38. say "Done"
  39.  
  40. exit
  41.